import { AnyAction } from 'redux';
import { assign } from 'lodash';
import ACTIONS from 'constants/action';

const initialState: Record<string, any> = {
  userinfo: null,
};

export default (state = initialState, action: AnyAction) => {
  switch (action.type) {
    case ACTIONS.FETCH_USERINFO_SUCCESS: {
      return assign({}, state, {
        userinfo: action.response.data,
      });
    }

    default:
      return state;
  }
};
